export default {
  data () {
    return {
      isAdmin: false
    }
  },
  computed: {
    xtInfo () {
      return this.$store.state.xtInfo
    },
    yhxx () {
      let yhxx = mySessionStorage.getItem("yhxx");
      if (!yhxx) {
        return null
      }
      this.isAdmin = yhxx.rybm === '0'
      return yhxx
    },
    xmItem () {
      return mySessionStorage.getItem("xm-item", {})
    },
    gzflItem () {
      return mySessionStorage.getItem("gzfl-item", { qysl: 0, zsl: 0 })
    },
    gzdyItem () {
      return mySessionStorage.getItem("gzdy-item", {})
    }
  },
  methods: {
    debounce (cb, time = 1000) {
      let timer = null
      return function () {
        if (timer) clearTimeout(timer)
        timer = setTimeout(() => {
          cb(...arguments)
        }, time)
      }
    },
    async preDel (fn, arg, msg) {
      try {
        await this.$confirm(msg || "删除将不可恢复，是否删除？", {
          type: "warning",
          closeOnClickModal: false,
          closeOnPressEscape: false,
          closeOnHashChange: false,
          // confirmButtonText: '删除',
          confirmButtonClass: 'deleteBtn'
        })
        fn(arg)
      } catch (e) {

      }
    }
  }
}
